import request from '@/utils/request'

export function getAll(params) {
  return request({
    url: '/bloodSpare',
    method: 'get',
    params,
  })
}

export function getOne(blood_id) {
  return request({
    url: '/bloodSpare/' + blood_id,
    method: 'get',
  })
}

export function addOne(data) {
  return request({
    url: '/bloodSpare',
    method: 'post',
    data,
  })
}

export function updateOne(blood_id, data) {
  return request({
    url: '/bloodSpare/' + blood_id,
    method: 'patch',
    data,
  })
}

export function deleteOne(blood_id) {
  return request({
    url: '/bloodSpare/' + blood_id,
    method: 'delete',
  })
}

export function multiSave(data) {
  return request({
    url: '/bloodSpare/multiSave',
    method: 'post',
    data,
  })
}

export function doPrint(id) {
  return request({
    url: `/bloodSpare/${id}/print`,
    method: 'post',
  })
}

export function doSync(force = 0) {
  return request({
    url: `/bloodSpare/sync`,
    method: 'post',
    data: { force },
  })
}
